<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>建材列表</title>
<link rel="stylesheet" href="lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
</head>
<body class="pos-r">
<div>
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 管理 <span class="c-gray en">&gt;</span> 项目类型 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover ">
				<thead>
					<tr class="text-c">
						<button class="btn" onclick="xiangmuleixing_add('增加','xiangmuleixing-add','800','400')">增加</button>
						<button class="btn" onclick="xiangmuleixing_del()">删除</button>
					</tr>
					<tr class="text-c">
						<th width="1"><input type="checkbox" value="" name=""></th>
						<th width="200">名称</th>
						<th width="200">类型</th>
						<th width="200">角色</th>
						<th width="50">操作</th>
					</tr>
				</thead>
				<tbody>
					<tr class="text-c va-m" th:each="type:${typeList}">
						<td><input type="checkbox" th:value="${type.id}" name="id" th:onclick="'javascript:check(\''+${type.id}+'\',event)'"></td>
						<td th:text="${type.name}"></td>
						<td th:text="${type.type}"></td>
						<td th:text="${type.role}"></td>
						<td>
							<a href="javascript:;"  th:onclick="'javascript:worklog_edit(\''++'\')'" class="layui-btn layui-btn-xs"><i class="Hui-iconfont Hui-iconfont-edit"></i> 编辑</a>
							&nbsp;&nbsp;
							<a href="javascript:;"  th:onclick="'javascript:worklog_view(\''++'\')'" class="layui-btn layui-btn-xs"><i class="Hui-iconfont"></i>绑定检查项</a>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
function xiangmuleixing_add(title,url,w,h){
	layer_show(title,url,w,h);
}	
function xiangmuleixing_edit(title,url,w,h){
	layer_show(title,url,w,h);
}
var ids=[]
function check(id,e){
    if(e.target.checked){//如果是被选中,则增加到数组
        ids.push(id);
    }else{
        var idx = ids.indexOf(id);
        ids.splice(idx, 1);//删除
    }
}
function xiangmuleixing_del(){
    var t = confirm("确认删除吗")
    if (t){
        var ids = [];
        $("input[type='checkbox']:not(:first)").each(function(){
            if($(this).is(":checked")){
                ids.push($(this).val())
            }else{
            }
        });
        if (!ids.length<1){
            $.ajax({
                type: "POST",
                url: "/delProjectType?ids="+ids,
                success:function (data) {
                    if (data=="200") {
                        layer.msg("删除成功！",{icon:1,time:2000})
                        setTimeout(function () {
                            window.location.reload();
                        },2000)
                    }
                },
                error: function (error) {
                    parent.layer.msg("删除失败！",{icon:1,time:2000})
                }
            });
        }
        return false;
    }
}
$('.table-sort').dataTable({
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[0,1,2,3,4,5]},// 制定列不参与排序
	]
});
</script>
</body>
</html>